﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class BuildPoint : MonoBehaviour {

    public GameObject turret;
    public Sprite MoveOn;
    public Sprite MoveOff;
    public SpriteRenderer SR;

    private void Start()
    {
        SR = transform.GetComponent<SpriteRenderer>();
    }

    public void TurretBuild(GameObject _turret)
    {
        turret = GameObject.Instantiate(_turret, transform.position, Quaternion.identity);
    }

    private void OnMouseEnter()
    {
        if(turret==null&&EventSystem.current.IsPointerOverGameObject()==false)
        {
            SR.sprite = MoveOn;
        }
    }
    private void OnMouseExit()
    {
        if (turret == null && EventSystem.current.IsPointerOverGameObject() == false)
        {
            SR.sprite = MoveOff;
        }
    }
}
